<?xml version="1.0" encoding="windows-1250"?>
<gxsl:stylesheet xmlns:gxsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/TransformAlias" xml:space="default">
  <gxsl:namespace-alias stylesheet-prefix="xsl" result-prefix="gxsl"/>
  <gxsl:output method="xml" encoding="windows-1250" cdata-section-elements="gxsl:comment" indent="yes"/>

  <gxsl:param name="cvincludepage"/>
  <gxsl:param name="cvinclude" select="$cvincludepage/.."/>
  <gxsl:param name="lang">cs</gxsl:param>

  <gxsl:template match="/">
    <xsl:stylesheet version="1.0">
      <xsl:output method="html" indent="no" encoding="windows-1250"/>
      <gxsl:apply-templates select="$cvinclude"/>
    </xsl:stylesheet>
  </gxsl:template>

  <gxsl:template match="CVInclude">

    <gxsl:variable name="dict" select="document('dictionary.xml')/Translation"/>

      <xsl:template match="DPEdit">

      <form method="post" name="edit">
        <xsl:attribute name="action">
          <xsl:text>?</xsl:text>
          <gxsl:for-each select="ancestor-or-self::CVInclude/../CVIRBindings/CVIRBinding">
            <gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">
              <gxsl:if test="position()!=1"><xsl:text>&amp;</xsl:text></gxsl:if><xsl:text><gxsl:value-of select="@p2"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/>
            </gxsl:if>
          </gxsl:for-each>
          <gxsl:for-each select="ancestor::CVInclude/Keys/Binding">
            <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
            <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
              <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
            </gxsl:if>
          </gxsl:for-each>
        </xsl:attribute>
          <table width="100%" cellpadding="6" cellspacing="0" border="0">
          <tr>
            <td>
              <p>
              <font size="+1"><b>
                <gxsl:value-of select="$dict/Text[@tid='rmv_record']/Value[@lang=$lang]"/>
              </b></font>
              </p>
            </td>
          </tr>

          <xsl:choose>
            <xsl:when test="count({@conceptcoll}/{@concept})>0">
              <gxsl:if test="ConsistencyChecks">
                <tr>
                  <td>
                    <p>
                    <font size="+1"><b>
                      <span class="consistency_check_main_title"><gxsl:value-of select="$dict/Text[@tid='consistency_check']/Value[@lang=$lang]"/>:</span>
                    </b></font>
                    </p>

                    <ul class="consistency_check_assoc">
                    <gxsl:for-each select="ConsistencyChecks/ConsistencyCheck">
                      <li><b><gxsl:value-of select="$dict/Text[@tid='assoc']/Value[@lang=$lang]"/>:&#160;</b><gxsl:choose><gxsl:when test="CATitles/CATitle[@id_lang=$lang]/Title and CATitles/CATitle[@id_lang=$lang]/Title!=''"><gxsl:value-of select="CATitles/CATitle[@id_lang=$lang]/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="substring-after(@association,'_')"/></gxsl:otherwise></gxsl:choose>, <b><gxsl:value-of select="$dict/Text[@tid='object']/Value[@lang=$lang]"/>:&#160;</b><gxsl:choose><gxsl:when test="CTitles/CTitle[@id_lang=$lang]/Title and CTitles/CTitle[@id_lang=$lang]/Title!=''"><gxsl:value-of select="CTitles/CTitle[@id_lang=$lang]/Title"/></gxsl:when><gxsl:otherwise><gxsl:value-of select="@concept"/></gxsl:otherwise></gxsl:choose>
                        <xsl:choose>
                          <xsl:when test="not(/DPOutput/DPConsistencyCheck/ConsistencyCheck[@association='{@association}'])">
                            <span class="consistency_check_ok_result"><br/>&#160;&#160;&#160;&#160;&#160;OK</span>
                          </xsl:when>
                          <xsl:otherwise>
                            <span class="consistency_check_inconsistency">
                            <xsl:for-each select="/DPOutput/DPConsistencyCheck/ConsistencyCheck[@work!='' and @include!='' and @association='{@association}']/Inconsistency">
                              <br/>&#160;&#160;&#160;&#160;&#160;<a target="_blank">
                              <!-- which package? -->
                              <xsl:attribute name="href">../<xsl:value-of select="concat(substring-before(/DPOutput/@package,'.'),'.',../@work,'/?dp=edit',../@include)"/>
                                <xsl:for-each select="KeyProperty">&amp;<xsl:value-of select="@name"/>=<xsl:value-of select="@value"/></xsl:for-each>
                              </xsl:attribute>

                              <nobr>
                              <gxsl:choose>
                                <gxsl:when test="LabelProperty">
                                  <gxsl:for-each select="LabelProperty">
                                    <b>
                                    <gxsl:choose>
                                      <gxsl:when test="CPTitles/CPTitle[@id_lang=$lang]/Title">
                                        <gxsl:value-of select="CPTitles/CPTitle[@id_lang=$lang]/Title"/>:&#160;
                                      </gxsl:when>
                                      <gxsl:otherwise>
                                        <gxsl:value-of select="@name"/>:&#160;
                                      </gxsl:otherwise>
                                    </gxsl:choose>
                                    </b>
                                    <xsl:value-of select="LabelProperty[@name='{@name}']/@value"/>
                                    <gxsl:if test="position()!=last()">,&#160;</gxsl:if>
                                  </gxsl:for-each>
                                </gxsl:when>
                                <gxsl:otherwise>
                                  <gxsl:for-each select="KeyProperty">
                                    <b>
                                    <gxsl:choose>
                                      <gxsl:when test="CPTitles/CPTitle[@id_lang=$lang]/Title">
                                        <gxsl:value-of select="CPTitles/CPTitle[@id_lang=$lang]/Title"/>:&#160;
                                      </gxsl:when>
                                      <gxsl:otherwise>
                                        <gxsl:value-of select="@name"/>:&#160;
                                      </gxsl:otherwise>
                                    </gxsl:choose>
                                    </b>
                                    <xsl:value-of select="KeyProperty[@name='{@name}']/@value"/>
                                    <gxsl:if test="position()!=last()">,&#160;</gxsl:if>
                                  </gxsl:for-each>
                                </gxsl:otherwise>
                              </gxsl:choose>
                              </nobr>
                              </a>
                            </xsl:for-each>
                            </span>
                          </xsl:otherwise>
                        </xsl:choose>
                      </li>
                    </gxsl:for-each>
                    </ul>
                  </td>
                </tr>
              </gxsl:if>
              <input type="hidden" name="dp" value="deletewc{@id_cvinclude}"/>
              <!--
              <input type="hidden" name="dp" value="delete{@id_cvinclude}"/>
              -->
                <tr>
                  <td>
                    <xsl:apply-templates select="{@conceptcoll}/{@concept}[1]"/>
                  </td>
                </tr>
                <tr>
                  <td align="right">
                    <gxsl:variable name="btntitle"><gxsl:value-of select="CVITitles/CVITitle[@id_cttype='deletebutton']/Title"/></gxsl:variable>
                    <gxsl:choose>
                      <gxsl:when test="not($btntitle) or $btntitle=''">
                        <input name="apply" type="submit" class="input_button">
                          <gxsl:attribute name="value"><gxsl:value-of select="$dict/Text[@tid='rmv']/Value[@lang=$lang]"/></gxsl:attribute>
                          <xsl:if test="/DPOutput/DPConsistencyCheck/ConsistencyCheck"><xsl:attribute name="disabled">true</xsl:attribute></xsl:if>
                        </input>
                      </gxsl:when>
                      <gxsl:otherwise>
                        <input name="apply" type="submit" class="input_button" value="{$btntitle}">
                          <xsl:if test="/DPOutput/DPConsistencyCheck/ConsistencyCheck"><xsl:attribute name="disabled">true</xsl:attribute></xsl:if>
                        </input>
                      </gxsl:otherwise>
                    </gxsl:choose>
                  </td>
                </tr>
            </xsl:when>
            <xsl:otherwise>
              <tr>
                <td>
                  <p>
                    <b><gxsl:value-of select="$dict/Text[@tid='already_removed']/Value[@lang=$lang]"/></b>
                  </p>
                </td>
              </tr>
            </xsl:otherwise>
          </xsl:choose>
          <tr>
            <td align="right" class="text">
              <nobr>
                <gxsl:if test="count(CVIStyles/CVIStyle[Style/StyleType/@name='delete'])&gt;1">
                  <gxsl:for-each select="CVIStyles/CVIStyle[Style/StyleType/@name='delete']">
                    <xsl:choose>
                      <xsl:when>
                        <gxsl:attribute name="test">@style=<gxsl:value-of select="position()"/></gxsl:attribute>
                        <gxsl:value-of select="Style/StyleTitles/StyleTitle[@id_lang=$lang]/Title"/>
                        <gxsl:if test="position()!=last()">&#160;|&#160;</gxsl:if>
                      </xsl:when>
                      <xsl:otherwise>
                        <a>
                          <xsl:attribute name="href">?dp=remove<gxsl:value-of select="../../@id_cvinclude"/>
                            <gxsl:for-each select="../../Keys/Binding">&amp;<gxsl:value-of select="@property"/>=<xsl:value-of select="{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/></gxsl:for-each>
                            <gxsl:for-each select="../../ancestor::CVInclude/../CVIRBindings/CVIRBinding"><gxsl:if test="not(../../CVInclude/Keys/Binding[@property=current()/@p2])">&amp;<gxsl:value-of select="@p2"/>=<xsl:value-of select="../DPNavig/{../../../../@conceptcoll}/{../../../../@concept}/@{@p1low}"/></gxsl:if></gxsl:for-each>
                            <gxsl:for-each select="../../ancestor::CVInclude/Keys/Binding">
                              <gxsl:variable name="property"><gxsl:value-of select="@property"/></gxsl:variable>
                              <gxsl:if test="not(../../CVIRels/CVIRel[descendant-or-self::CVInclude/@id_cvinclude=$cvinclude/@id_cvinclude]/CVIRBindings/CVIRBinding[@p1=$property])">
                                <xsl:text>&amp;<gxsl:value-of select="@property"/>=</xsl:text><xsl:value-of select="../DPNavig/{../../@conceptcoll}/{../../@concept}/@{@propertylow}"/>
                              </gxsl:if>
                            </gxsl:for-each>&amp;style=<gxsl:value-of select="position()"/>
                          </xsl:attribute>
                          <gxsl:value-of select="Style/StyleTitles/StyleTitle[@id_lang=$lang]/Title"/>
                        </a><gxsl:if test="position()!=last()">&#160;|&#160;</gxsl:if>
                      </xsl:otherwise>
                    </xsl:choose>
                  </gxsl:for-each>
                </gxsl:if>
              </nobr>
            </td>
          </tr>
        </table>
      </form>
    </xsl:template>


    <xsl:template match="{@concept}">

      <table cellpadding="6" cellspacing="0">

      <gxsl:for-each select="CVIProperties/CVIProperty[not(PropGroup/@reltype) or PropGroup/@reltype='none' or PropGroup/@reltype='1:1' or @key='1']">

      <gxsl:choose>
        <gxsl:when test="@ondetail!='hide'">
          <tr>
            <td>

              <table cellpadding="0" cellspacing="0">
                <tr>
                  <td>
                    <b><font size="-1"><gxsl:value-of select="Title"/>: <gxsl:if test="@mandat='1'"><span class="mandat">* </span></gxsl:if></font></b>
                  </td>
                </tr>
                <tr>
                  <td>
                    <gxsl:choose>
                      <gxsl:when test="CPStaticValues/CPStaticValue">
                        <gxsl:variable name="valsrcprm">
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">@<gxsl:value-of select="@nicknamelow"/></gxsl:when>
                            <gxsl:otherwise><gxsl:value-of select="@nickname"/></gxsl:otherwise>
                          </gxsl:choose>
                        </gxsl:variable>
                        <xsl:choose>
                          <gxsl:for-each select="CPStaticValues/CPStaticValue">
                            <xsl:when test="{$valsrcprm}='{statval}'"><gxsl:value-of select="title"/></xsl:when>                    
                          </gxsl:for-each>
                          <xsl:otherwise><xsl:value-of select="{$valsrcprm}"/></xsl:otherwise>
                        </xsl:choose>
                      </gxsl:when>
                      <gxsl:when test="@ref and @ref!=''">
                        <gxsl:choose>
                          <gxsl:when test="@fetchtype='direct'">
                            <gxsl:choose>
                              <gxsl:when test="RefProp">
                                <gxsl:choose>
                                  <gxsl:when test="@attr='1'">
                                    <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
                                  </gxsl:when>
                                  <gxsl:otherwise>
                                    <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
                                  </gxsl:otherwise>
                                </gxsl:choose>
                                <gxsl:for-each select="RefProp">
                                  <gxsl:choose>
                                    <gxsl:when test="@attr='1'">
                                      <xsl:value-of select="@{@nicknamelow}"/><gxsl:if test="position()!=last()">,&#160;</gxsl:if>
                                    </gxsl:when>
                                    <gxsl:otherwise>
                                      <xsl:value-of select="{@nickname}"/><gxsl:if test="position()!=last()">,&#160;</gxsl:if>
                                    </gxsl:otherwise>
                                  </gxsl:choose>
                                </gxsl:for-each>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <gxsl:choose>
                                  <gxsl:when test="@attr='1'">
                                    <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
                                    <xsl:value-of select="@{@nicknamelow}"/>
<!--
                                    <input type="hidden" name="{@formcode}" value="{{@{@refproplow}}}"/>
                                    <xsl:value-of select="@{@refproplow}"/>
-->
                                  </gxsl:when>
                                  <gxsl:otherwise>
                                    <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
                                    <xsl:value-of select="{@nickname}"/>
<!--
                                    <input type="hidden" name="{@formcode}" value="{{{@refprop}}}"/>
                                    <xsl:value-of select="{@refprop}"/>
-->
                                  </gxsl:otherwise>
                                </gxsl:choose>
                              </gxsl:otherwise>
                            </gxsl:choose>
                          </gxsl:when>
                          <gxsl:when test="@fetchtype='external'">
                            <gxsl:choose>
                              <gxsl:when test="RefProp">
                                <gxsl:choose>
                                  <gxsl:when test="@attr='1'">
                                    <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
                                  </gxsl:when>
                                  <gxsl:otherwise>
                                    <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
                                  </gxsl:otherwise>
                                </gxsl:choose>
                                <gxsl:choose>
                                  <gxsl:when test="@attr='1'">
                                    <xsl:value-of select="@{@nicknamelow}"/>
                                  </gxsl:when>
                                  <gxsl:otherwise>
                                    <xsl:value-of select="{@nickname}"/>
                                  </gxsl:otherwise>
                                </gxsl:choose>
                                <table>
                                  <gxsl:for-each select="RefProp">
                                    <tr>
                                      <td>
                                        &#160;&#160;&#160;&#160;&#160;<b><font size="-1"><gxsl:value-of select="Title"/>:</font></b>&#160;
                                      </td>
                                      <td>
                                        <gxsl:choose>
                                          <gxsl:when test="@attr='1'">
                                            <xsl:value-of select="@{@nicknamelow}"/>
                                          </gxsl:when>
                                          <gxsl:otherwise>
                                            <xsl:value-of select="{@nickname}"/>
                                          </gxsl:otherwise>
                                        </gxsl:choose>
                                      </td>
                                    </tr>
                                  </gxsl:for-each>
                                </table>
                              </gxsl:when>
                              <gxsl:otherwise>
                                <gxsl:choose>
                                  <gxsl:when test="@attr='1'">
                                    <input type="hidden" name="{@formcode}" value="{{@{@refproplow}}}"/>
                                    <xsl:value-of select="@{@refproplow}"/>
                                  </gxsl:when>
                                  <gxsl:otherwise>
                                    <input type="hidden" name="{@formcode}" value="{{{@refprop}}}"/>
                                    <xsl:value-of select="{@refprop}"/>
                                  </gxsl:otherwise>
                                </gxsl:choose>
                              </gxsl:otherwise>
                            </gxsl:choose>
                          </gxsl:when>
                        </gxsl:choose>
                      </gxsl:when>
                      <gxsl:when test="@type='boolean'">
                        <xsl:variable name="value">
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">
                              <xsl:value-of select="@{@nicknamelow}"/>
                            </gxsl:when>
                            <gxsl:otherwise>
                              <xsl:value-of select="{@nickname}"/>
                            </gxsl:otherwise>
                          </gxsl:choose>
                        </xsl:variable>
                        <input type="hidden" name="{@formcode}" value="{{$value}}"/>
                        <xsl:choose>
                          <xsl:when test="$value='1'"><gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/></xsl:when>
                          <xsl:when test="$value='0'"><gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/></xsl:when>
                          <xsl:otherwise><!--<gxsl:value-of select="$dict/Text[@tid='Unspecified']/Value[@lang=$lang]"/>--></xsl:otherwise>
                        </xsl:choose>
                      </gxsl:when>
                      <gxsl:when test="@type='boolean_txt'">
                        <xsl:variable name="value">
                          <gxsl:choose>
                            <gxsl:when test="@attr='1'">
                              <xsl:value-of select="@{@nicknamelow}"/>
                            </gxsl:when>
                            <gxsl:otherwise>
                              <xsl:value-of select="{@nickname}"/>
                            </gxsl:otherwise>
                          </gxsl:choose>
                        </xsl:variable>
                        <input type="hidden" name="{@formcode}" value="{{$value}}"/>
                        <xsl:choose>
                          <xsl:when test="$value='true'"><gxsl:value-of select="$dict/Text[@tid='Yes']/Value[@lang=$lang]"/></xsl:when>
                          <xsl:when test="$value='false'"><gxsl:value-of select="$dict/Text[@tid='No']/Value[@lang=$lang]"/></xsl:when>
                          <xsl:otherwise><!--<gxsl:value-of select="$dict/Text[@tid='Unspecified']/Value[@lang=$lang]"/>--></xsl:otherwise>
                        </xsl:choose>
                      </gxsl:when>
                      <gxsl:when test="@type='url'">
                        <gxsl:choose>
                          <gxsl:when test="@attr='1'">
                            <xsl:if test="@{@nicknamelow} and @{@nicknamelow}!=''">
                              <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
                              <font size="-1">url - <b><xsl:value-of select="@{@nicknamelow}" disable-output-escaping="yes"/></b></font><br/>
                            </xsl:if>
                          </gxsl:when>
                          <gxsl:otherwise>
                            <xsl:if test="{@nickname} and {@nickname}!=''">
                              <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
                              <font size="-1">url - <b><xsl:value-of select="{@nickname}" disable-output-escaping="yes"/></b></font><br/>
                            </xsl:if>
                          </gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:when>
                      <gxsl:otherwise>
                        <gxsl:choose>
                          <gxsl:when test="@attr='1'">
                            <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
                            <xsl:value-of select="@{@nicknamelow}"/>
                          </gxsl:when>
                          <gxsl:otherwise>
                            <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
                            <xsl:value-of select="{@nickname}"/>
                          </gxsl:otherwise>
                        </gxsl:choose>
                      </gxsl:otherwise>
                    </gxsl:choose>
                  </td>
                </tr>
              </table>

            </td>
          </tr>

        </gxsl:when>
<!--
        <gxsl:when test="@key='1'">
            <gxsl:choose>
              <gxsl:when test="@attr='1'">
                <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
              </gxsl:when>
              <gxsl:otherwise>
                <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
              </gxsl:otherwise>
            </gxsl:choose>
        </gxsl:when>

        <gxsl:when test="../../../CVIRBindings/CVIRBinding[@p2=current()/@name]">
          <input type="hidden" name="{@formcode}" value="{{/DPOutput/DPNavig/{../../../../../@conceptcoll}/{../../../../../@concept}/@{../../../CVIRBindings/CVIRBinding[@p2=current()/@name]/@p1low}}}"/>
        </gxsl:when>
-->
        <gxsl:otherwise>
            <gxsl:choose>
              <gxsl:when test="@attr='1'">
                <input type="hidden" name="{@formcode}" value="{{@{@nicknamelow}}}"/>
              </gxsl:when>
              <gxsl:otherwise>
                <input type="hidden" name="{@formcode}" value="{{{@nickname}}}"/>
              </gxsl:otherwise>
            </gxsl:choose>
        </gxsl:otherwise>
      </gxsl:choose>

      </gxsl:for-each>

      </table>

    </xsl:template>

    <xsl:template name="title"><gxsl:value-of select="ancestor::CView/CVTitles/CVTitle/Title"/></xsl:template>

  </gxsl:template>

</gxsl:stylesheet>